﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Opgave2
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            for (char i = 'A'; i <= 'Z'; i++)
            {
                Button tmp = new Button();
                tmp.Text = i.ToString();
                form1.Controls.Add(tmp);
            }

            if (Page.IsPostBack)
            {
                Random rnd = new Random();
                ListItem l = new ListItem(rnd.Next().ToString());
                randomNumbers.Items.Add(l);
                
                if (randomNumbers.Items.Count > 2)
                {
                    ListItem li = randomNumbers.Items[0];
                    randomNumbers.Items.Remove(li);
                }
            }
        }
    }
}